<?php 

function IncludeJavascripts()
{
    $jsFiles = array(
        'includes/jquery-1.7.2.min.js',
        'includes/base.js',
        'includes/EventDispatcher.class.js',
        'includes/handler.js',
        'classes/Point.class.js',
        'classes/Stage.class.js',
        'classes/DisplayObject.class.js',
        'classes/UserInterface.class.js',
        'main.js',
        'classes/GameField.class.js',
        'classes/Snake.class.js',
        'classes/SnakeSegment.class.js',
        'classes/SnakeHead.class.js',
        'classes/SnakeTail.class.js',
        'classes/SnakeFood.class.js'
    );    

    $replacePattern = '<script type="text/javascript" src="/js/%s"></script>';
    foreach ($jsFiles as $jsFile)
    {
        printf($replacePattern, $jsFile);
        echo "\n";    
    }
}

?>

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="/css/style.css">
    <?= IncludeJavascripts() ?>
    <title>Tests site</title>
  </head>
  <body>
    <div class="scores_container">
      <h4 class="description">Score:</h4>
      <span id="score" class="score">0</span>
    </div>
    <div class="right_menu">
      <div class="controls_description">
        <h4 class="description">Controls:</h4>
        <p>
          <strong>&larr;&uarr;&rarr;&darr;</strong> - Change snake direction
        </p>
        <p>
          <strong>Space</strong> - Pause/Resume/Restart
        </p>
      </div>
      <a id="controlButton" href="javascript:void(0);" class="start_button">Start</a>
    </div>
    <canvas width="640" height="480" id="snakeCanvas" class="snake_canvas">
      Your browser doesn't support canvas tag.
    </canvas>
    <div id="infoLayer" class="info_layer">
      <div>Click <strong>Start</strong> button or press <strong>Space</strong> key to start the game</div>
    </div>
  </body>
</html>